package org.azmat.student.SQL.Service.Impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.azmat.student.SQL.Service.IStudentService;
import org.azmat.student.SQL.Entity.Student;
import org.azmat.student.SQL.Mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> implements IStudentService {
    @Autowired
    private StudentMapper studentMapper;

    public IPage<Student> selectPage(int pageNum, int pageSize,String search) {
        Page<Student> page = new Page<>(pageNum, pageSize);
        IPage<Student> userIPage = studentMapper.selectPage(page, Wrappers.<Student>lambdaQuery().like(Student::getStudentName, search));
        return userIPage;
    }
}
